# set project's name
PROJECT( LightModel )

#ADD_DEFINITIONS(-DUNICODE)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)

# Path to additional CMake modules
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules ${CMAKE_MODULE_PATH})

###############################################################################
# CMake settings
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.3)

ADD_DEFINITIONS(-DUNICODE)

FIND_PACKAGE(Qt4 REQUIRED)


SET(QT_USE_QTMAIN TRUE)
SET(QT_USE_QTOPENGL TRUE)
SET(QT_USE_QTXML TRUE)
INCLUDE(${QT_USE_FILE})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})



FILE(GLOB_RECURSE HDRS_FILES *.h *.hpp)
FILE(GLOB_RECURSE SRCS_FILES *.cpp)
FILE(GLOB_RECURSE UI_FILES *.ui)
FILE(GLOB CD_FILES *.cd)
FILE(GLOB_RECURSE RSCS *.qrc)

QT4_WRAP_CPP(MOC_SRCS ${HDRS_FILES})
QT4_ADD_RESOURCES(RSC_SRCS ${RSCS})
QT4_WRAP_UI(UI_HDRS ${UI_FILES})


###############################################################################
FIND_PACKAGE(OSG REQUIRED)

IF (OSG_FOUND)
	MESSAGE(${OSG_INCLUDE_DIR})
	MESSAGE(${OSG_LIBRARIES})
ENDIF (OSG_FOUND)

#apply them to following projects
INCLUDE_DIRECTORIES(${OSG_INCLUDE_DIR})

SOURCE_GROUP("UI Files" FILES ${UI_FILES})
SOURCE_GROUP("Generated Files" FILES ${MOC_SRCS} ${UI_HDRS} ${RSC_SRCS})
SOURCE_GROUP("Class Diagrams" FILES ${CD_FILES} )
SOURCE_GROUP("Resources" FILES ${RSCS} )

ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS_FILES} ${HDRS_FILES} ${MOC_SRCS} ${UI_FILES} ${UI_HDRS} ${RSC_SRCS} ${CD_FILES})
set_source_files_properties(${CD_FILES} PROPERTIES HEADER_FILE_ONLY TRUE) #DO NOT COMPILE CS FILES
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${OSG_LIBRARIES} ${QT_LIBRARIES} )
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VS_KEYWORD Qt4VSv1.0)

INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)



